package pip.can;

public class Content {
	public int ContentId;
	private Chunk[] Chunks;
	private int noChunks;
	public Content(int size, int id)
	{
		ContentId=id;
		noChunks=(int) Math.ceil((double)size/(double)StaticVariables.chunkSize);
		Chunks= new Chunk[noChunks];
		int i;
		for (i=0; i<noChunks-1; i++)
		{
			Chunks[i]=new Chunk(StaticVariables.chunkSize, ContentId,i);
			size=size-StaticVariables.chunkSize;
		}
		Chunks[i]=new Chunk(size, ContentId,i);
	}
	
	public Chunk getChunk(int id)
	{
		return Chunks[id];
	}
	public int getNoChunks()
	{
		return this.noChunks;
	}
}
